package com.rayboo.example.design.pattern.factory.abs;


public class SuvCarFactory implements CarFactory<SuvCar> {

    @Override
    public SuvCar create(String color) {
        if (RED.equals(color)) {
            return new SuvCar(RED);
        } else if (GREEN.equals(color)) {
            return new SuvCar(GREEN);
        } else if (BLUE.equals(color)) {
            return new SuvCar(BLUE);
        } else {
            throw new RuntimeException("No " + color + " suv car.");
        }
    }
}
